//
//  FirstCenterView.m
//  SinaWebo
//
//  Created by 亦心 on 16/7/18.
//  Copyright © 2016年 亦心. All rights reserved.
//

#import "FirstCenterView.h"
#import "Element.h"
#import "PageInfo.h"
#import "Mblog.h"
#import "PicInfo.h"
#import "PicMetadata.h"
#import <UIImageView+WebCache.h>

@interface FirstCenterView ()
@property (weak, nonatomic) IBOutlet UIImageView *imageView;
@property (weak, nonatomic) IBOutlet UIView *centerV;
@property (weak, nonatomic) IBOutlet UILabel *contentL;
@property (weak, nonatomic) IBOutlet UILabel *titleL;

@end

@implementation FirstCenterView

+ (instancetype)firstCenterView{
    return [[NSBundle mainBundle] loadNibNamed:NSStringFromClass(self) owner:nil options:nil].lastObject;
}

- (void)setFrame:(CGRect)frame{
    [super setFrame:frame];
    self.centerV.width = self.width;
    self.centerV.height = self.centerV.width;
}

- (void)setElement:(Element *)element{
    _element = element;
    _contentL.text = _element.desc1;
    _titleL.text = _element.desc2;
    
    PicInfo *pic = _element.mblog.page_info.pic_info;
    PicMetadata *picMeta = pic.pic_small;
    [_imageView sd_setImageWithURL:[NSURL URLWithString:picMeta.url]];
}

@end
